package com.zszq.ms.bigmodeltest.controller;


import com.zszq.ms.bigmodeltest.domain.response.Result;
import com.zszq.ms.bigmodeltest.service.AiFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件前端控制器
 *
 * @author ms
 * @since 2025-04-02
 */
@RestController
@RequestMapping("/ai-file")
public class AiFileController {
    @Autowired
    private AiFileService aiFileService;

    @PostMapping("/upload")
    public Result chat(@RequestPart("file") MultipartFile file) {
        if (file == null) {
            return Result.failure("文件不能为空");
        }
        return Result.success(aiFileService.upload(file));
    }
}
